package br.org.bertol.mestrado.engine.optimisation.pso;

public class Velocity {
    private int par1;

    private int par2;

    /**
     * Cria par de trocas de uma velocidade
     * @param par1
     *            posição de
     * @param par2
     *            posiçã para
     */
    public Velocity(final int par1, final int par2) {
        this.par1 = par1;

        this.par2 = par2;
    }

    public final int getPar1() {
        return par1;
    }

    public final int getPar2() {
        return par2;
    }

    public final void setPar2(final int par2) {
        this.par2 = par2;
    }

    public final void setPar1(final int par1) {
        this.par1 = par1;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public final String toString() {

        final StringBuilder buffer = new StringBuilder();

        buffer.append("[PAR : " + par1 + " - " + par2 + " ]");

        return buffer.toString();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public final int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + par1;
        result = prime * result + par2;
        return result;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public final boolean equals(final Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (!(obj instanceof Velocity)) {
            return false;
        }
        Velocity other = (Velocity) obj;
        if (par1 != other.par1) {
            return false;
        }
        if (par2 != other.par2) {
            return false;
        }
        return true;
    }
}
